package view;

import model.*;
import javax.swing.JPanel;

/**
 * AbstractView
 * @author Team X
 * @version 1
 */
public abstract class AbstractView extends JPanel 
{
	// Object ID
	private static final long serialVersionUID = 6437976554496769048L;
	// Simulation
	protected Simulator simulator;

	/**
	 * AbstractView constructor
	 * @param simulator - The Simulator instance
	 */
	public AbstractView(Simulator simulator) 
	{
		this.simulator=simulator;
		simulator.addView(this);
	}
	
	/**
	 * Get Simulator object
	 * @return Simulator simulator
	 */
	public Simulator getSimulator()
	{ return simulator; }
	
	/** All views should implement this method to prevent the ease of creating a panel in the constructor. */
	protected abstract void createView();
	
	/** Update views */
	public void updateView()
	{
		repaint();
	}
}
